#ifndef FIFO_H
#define FIFO_H

#ifdef __cplusplus
extern "C" {
#endif
  
#include <stdint.h>

/**
 * \struct fifo_st
 * FIFO?????.
 */
typedef struct 
{
  volatile uint32_t in;          /**< ????        */ 
  volatile uint32_t out;         /**< ????        */ 
  volatile uint32_t len;         /**< ??????    */ 
  uint32_t buffer_len;  /**< ????        */ 
  uint8_t* buffer;      /**< ??,????   */

} fifo_st;
  
/**
 * \fn fifo_in
 * ?fifo????
 * \param[in] dev \ref fifo_st
 * \param[in] buffer ??????
 * \param[in] len ??????
 * \retval ??????????
 */
uint32_t fifo_in(fifo_st* dev, uint8_t* buffer, uint32_t len);

/**
 * \fn fifo_out
 * ?fifo????
 * \param[in] dev \ref fifo_st
 * \param[in] buffer ??????
 * \param[in] len ?????????
 * \retval ??????????
 */
uint32_t fifo_out(fifo_st* dev, uint8_t* buffer, uint32_t len);

uint32_t fifo_getfree(fifo_st* dev);

uint32_t fifo_getlen(fifo_st* dev);

void fifo_clean(fifo_st* dev);
#ifdef __cplusplus
}
#endif

#endif


